package org.example.hellomp.test;

import io.minio.BucketExistsArgs;
import io.minio.MinioClient;
import io.minio.ObjectWriteResponse;
import io.minio.UploadObjectArgs;
import io.minio.errors.*;

import java.io.File;
import java.io.IOException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;

public class T1 {

    public static void main(String[] args) throws ServerException, InsufficientDataException, ErrorResponseException, IOException, NoSuchAlgorithmException, InvalidKeyException, InvalidResponseException, XmlParserException, InternalException {
        MinioClient minioClient = MinioClient.builder()
                .endpoint("http://192.168.220.100:9000")
                .credentials("minioadmin", "minioadmin")
                .build();
        BucketExistsArgs build = BucketExistsArgs.builder().bucket("lease").build();
        boolean b = minioClient.bucketExists(build);
        System.out.println("================="+b+"=================");





        UploadObjectArgs uploadObjectArgs = UploadObjectArgs.builder()
                .filename("E:/develop/123.jpg")
                .bucket("lease")
                .object("12345.jpg")
                .build();
        ObjectWriteResponse objectWriteResponse = minioClient.uploadObject(uploadObjectArgs);



    }

}
